package cc.taofoo.LeetCode.按摩师;

public class Main {
    public static void main(String[] args) {
        System.out.println(new Solution().massage(new int[]{2, 1, 4, 5, 3, 1, 1, 3}));
    }
}
class Solution {
    int tmp[] = new int[1000];

    public int massage(int[] nums) {
        if(nums.length == 0)
            return 0;
        if(nums.length ==1)
            return nums[0];
        tmp[1] = nums[0];
        tmp[2] = Math.max(nums[0],nums[1]);
        for(int i = 3 ;i<= nums.length;i++){
            tmp[i] = Math.max(nums[i-1]+tmp[i-2],tmp[i-1]);
        }
        return tmp[nums.length];
    }



}